﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工装请制进度统计</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style>
        .easyui-linkbutton{margin-left:20px;}
        table tr td{padding:0px 5px}
        .status {margin-top: -27px;}
        .status span{width:80px;height: 50px;padding: 5px 10px;margin: 0 15px;box-shadow:0px 0px 5px 1px #000; }
    </style>
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
           <form id="searchForm" method="post">
	    	<table>
	    		<tr class="divLabel">
                    <td>件号:</td>
                    <td>工艺路线:</td>
                    <td>计划时间:</td>
	    		</tr>
	    		<tr>
	    			<td><input  name="productname" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
	    			<td><input  name="WorkflowID" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>
                        <input class="easyui-datebox" name="StartDate" style="width: 120px; height: 22px" />至
                        <input class="easyui-datebox" name="EndDate" style="width: 120px; height: 22px"/>
                    </td>
                    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchData()">查询</a></td>
	    			<td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchReset()">重置</a></td>
	    		</tr>
	    	</table>
	    </form>
        </div> 
    </div>

    <div class="panelSection">    
      <div class="easyui-panel " title="工装请制进度统计" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
        <table id="ToolsProgressCensus" style="height:440px;width:100%" data-options="rownumbers:true"></table>
        <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                     buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]
                ">
                    </div>
        </div>
        <div class="status">
            <span style="background-color:#69b400">已完成</span><span style="background-color:cyan">进行中</span><span style="background-color:#ddd">未开始</span>
        </div>
      </div>
      <div id="win"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script>
    //创建人：longb
    //日期：2022-07-22
    //描述：工装工具定检提醒查询
    var page = {
        pagetotal: 0,
        pageSize: 20,
        pageNumber: 1,
        index: null,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ZsHandler/ZSSendRequestHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        columns: [], //[{ field: 'A1', title: '工序任务', width: '100px'}],
        //页面事件绑定
        bind: function () {
            page.initToolsProgressCensus(null);
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.GetToolsProgressCensus();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.GetToolsProgressCensus();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.reset(true, true);
                page.pageNumber = 1; page.pagetotal = 0
                $('#pp').pagination('refresh', {
                    total: page.pagetotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
            });

        },
        initToolsProgressCensus: function (data) {
            $('#ToolsProgressCensus').datagrid({
                checkOnSelect: true,
                selectOnCheck: false,
                singleSelect: true,
                rownumbers: true,
                data: data,
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pagetotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                frozenColumns: [[
                 { field: 'Containername', title: '工装请制订单号', width: 140 },
                 { field: 'Productname', title: '工装工具图号', width: 140 },
		         { field: 'Description', title: '工装工具名称', width: 140 },
                 { field: 'originalstartdate', title: '计划开始时间', width: 90 },
                 { field: 'DESCRIPTION', title: '计划完成时间', width: 100 }
                ]],
                columns: [page.columns]
            });
        },
        SetCellColor: function (value) {
            switch (value) {
                case '1':
                    return 'background-color:#ddd;'; break;
                case '6':
                    return 'background-color:#69b400;'; break;
                default:
                    return 'background-color:cyan;'; break;
            }

        },
        //查询
        searchData: function () {
            clearMessage();
            page.pageNumber = 1;
            page.GetToolsProgressCensus();
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
            clearMessage();
        },
        //查询任务单信息
        GetToolsProgressCensus: function () {
            $('#ToolsProgressCensus').datagrid('loadData',[]);
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "GetToolsProgressCensus",
                pageSize: page.pageSize,
                pageNumber: page.pageNumber,
                data: JSON.stringify([data])
            };
            page.post(param, function (res) {
                if (res.Result) {
                    page.pagetotal = res.RowCount;
                    var columns = [];
                    $.each(res.ReturnData, function (index, item) {
                        columns.push({ field: item.field, width: '100px', title: item.title, styler: function (value, row, index) { if (value != null && !isNaN(value)) { return page.SetCellColor(value); } }, formatter: function (value, row, index) { if (!isNaN(value)) { return ''; } else { return value; } } })
                    });
                    page.columns = columns
                    page.initToolsProgressCensus(res.DBTable);
                    ///$('#ToolsProgressCensus').datagrid('loadData', res.DBTable);
                } else {
                    displayMessage(res.Message, false);
                }

            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: true,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    $(function () {
        page.init();
    });
    function openSpecDetailwins(Containerid, Specid, Sequence) {
        window.showModalDialog("/InSiteWebApplication/forms/shopfloor/uMESReport/uMESReportWorkingDetail.aspx?Containerid=" + Containerid + '&Specid=' + Specid + '&Sequence=' + Sequence, "生产情况明细", "dialogWidth:810px; dialogHeight:1240px;dialogLeft:150px;dialogTop:0px; edge:Raised; center: Yes; resizable: NO; status: No;");
    }
    
    function openSpecDetailwinsNew(Containerid, Specid, Sequence, WorkFlowStepID, stepName) {
        $('#win').dialog({
            title: '生产情况明细',
            width: 1020,
            height: 600,
            modal: true,
            href: "/InSiteWebApplication/forms/shopfloor/uMESReport/uLMSReportWorkingDetailNew.aspx?Containerid=" + Containerid + '&Specid=' + Specid + '&Sequence=' + Sequence + '&WorkFlowStepID=' + WorkFlowStepID + '&WorkFlowStepName=' + encodeURI(stepName)
        });
        //window.showModalDialog("uLMSReportWorkingDetailNew.aspx?Containerid=" + Containerid + '&Specid=' + Specid + '&Sequence=' + Sequence + '&WorkFlowStepID=' + WorkFlowStepID + '&WorkFlowStepName=' + encodeURI(stepName), "生产情况明细", "dialogWidth:" + width + "px; dialogHeight:" + height + "px;dialogLeft:" + left + "px;dialogTop:" + top + "px; edge:Raised; center: Yes; resizable: No; status: No;")
    }
    function openConDetailwins(Containerid) {
        window.showModalDialog("uMESContainerSelectInfo.aspx?Containerid=" + Containerid, "批次信息汇总", "dialogWidth:850px; dialogHeight:700px;dialogLeft:150px;dialogTop:200px; edge:Raised; center: Yes; resizable: NO; status: No;");
    }

</script>
